export default {
    addCart(context, payload) {
        return new Promise((resolve, reject) => {
            let oldprocuct = context.state.cartList.find(item => item.iid === payload.iid)

            if (oldprocuct) {
                context.commit('addcounter', oldprocuct)
                resolve('当前商品数量+1')
            } else {
                payload.count = 1
                context.commit('unadd', payload)
                resolve('已添加新商品！')
            }
        })

    }
}